package com.kasinf.sample.excel.entity;

import cn.idev.excel.annotation.ExcelProperty;
import com.kasinf.framework.excel.core.annotations.*;
import com.kasinf.framework.excel.core.convert.DictConvert;
import jakarta.validation.constraints.Min;
import jakarta.validation.constraints.NotNull;
import lombok.AccessLevel;
import lombok.Data;
import lombok.experimental.FieldDefaults;

/**
 * @Author : Kaiser
 * @Date: 2025/5/14  14:15
 */
@Data
@FieldDefaults(level = AccessLevel.PRIVATE)
public class TestEntity {
    int id;
    @ExcelMerge
    @ExcelRequired
    @ExcelNotation(value = "姓名长度限制为10")
    @ExcelProperty(value = "姓名")
    @NotNull(message = "姓名不得为空")
    String name;
    @ExcelProperty(value = "年龄")
    @Min(value = 1, message = "年龄不得小于1岁")
    int age;
    @ExcelProperty(value = "居住地址")
    String address;
    @ExcelDictFormat(enumClass = SexEnum.class)
    @ExcelColumnSelect(enumClass = SexEnum.class)
    @ExcelProperty(value = "性别", converter = DictConvert.class)
    String sex;
    @ExcelDictFormat(value = "user_type")
    @ExcelColumnSelect(dictType = "user_type")
    @ExcelProperty(value = "用户类型", converter = DictConvert.class)
    Integer type;
    @ExcelColumnSelect(functionName = "user_status")
    @ExcelProperty(value = "状态")
    Integer status;
}
